package nccloud.riart.pub.utils;

import java.util.List;

import nc.bs.framework.common.NCLocator;
import nc.md.model.MetaDataException;
import nc.md.persist.framework.IMDPersistenceQueryService;
import nc.vo.sm.UserVO;

public class QueryDatabaseUtils {
	@SuppressWarnings("unchecked")
	public static String getNameByUserPk(String pk_user) throws MetaDataException {
		IMDPersistenceQueryService service = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
		UserVO userVO = ((List<UserVO>) service.queryBillOfVOByCond(UserVO.class,
				"cuserid = '" + pk_user + "' and dr = 0", false)).get(0);
		return userVO.getUser_name();
	}

	public static String getCodeByUserPk(String pk_user) throws MetaDataException {
		IMDPersistenceQueryService service = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
		UserVO userVO = ((List<UserVO>) service.queryBillOfVOByCond(UserVO.class,
				"cuserid = '" + pk_user + "' and dr = 0", false)).get(0);
		return userVO.getUser_code();
	}
}
